#ifndef MAINWINDOW_H
#define MAINWINDOW_H


#include "proto_unit.h"

#include <QtGui/QMainWindow>
#include <settingsdialog.h>
#include <messageswindow.h>
#include <QCloseEvent>
#include <QSystemTrayIcon>
#include <QMenu>
#include <QSettings>
#include <QMessageBox>
#include <QTimer>
#include <QTextCodec>
#include <QThread>
#include <QMutex>

namespace Ui
{
    class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    SETTINGS settings;
    MainWindow(QWidget *parent = 0);
    ~MainWindow();
    void On();
    void Off();
    void setClientProt(CLIENTPROT * cp);
    void showMessage(const QString &msg);
    void setDirNames(const QStringList &dirs);

private:
    SettingsDialog * setdial;
    MessagesWindow * messwin;
    QSystemTrayIcon * trayicon;
    QMenu * traymenu;
    QTextCodec *codec;
    QTimer *timer, *timer2;
    QMutex *filemutex;
    Ui::MainWindow *ui;
    CLIENTPROT * clnp;
    bool Online;
    void closeEvent(QCloseEvent *event);
    void writeSettings();
    void readSettings();
    bool okToExit();

 public slots:
    void showSettingsDialog();
    void showMessagesWindow();
    void connectPressed(bool is);
    void closeApplication();
    void iconClicked(QSystemTrayIcon::ActivationReason reason);
    void aboutProgram();
    void updateStatistics();
    void connectToServer();
    void disconnectFromServer();
    void Foo(int a);
    void ShowMessage(const char * message, int i, int showTime, int sendTime);
    void SetDirName(const string16 * dn, int winKOI);
    void timerTimeout();
};

#endif // MAINWINDOW_H
